package logic

import (
	"context"
	"hem/hemrpc/hemrpcclient"

	"hem/api/internal/svc"
	"hem/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type HemShowLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewHemShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *HemShowLogic {
	return &HemShowLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *HemShowLogic) HemShow(req *types.HemShowRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	show, err := l.svcCtx.HemShow(l.ctx, &hemrpcclient.HemShowRequest{
		HemId: int64(req.HemId),
	})
	if err != nil {
		return &types.Response{
			Message: err.Error(),
			Data:    500,
			Code:    nil,
		}, nil
	}
	return &types.Response{
		Message: "查询成功",
		Data:    200,
		Code:    show,
	}, nil

}
